1. Field of the Invention
This invention relates to an image processing apparatus, method and program. More particularly, the invention relates to an apparatus, method and program for estimating the color temperature of a photographic light source based upon applied image data.
2. Description of the Related Art
Photo printing devices utilizing digital exposure, namely digital photo printers, are now in actual use. Such a printer optoelectronically reads an image that has been recorded on photographic film such as negative film or color reversible film, converts the read image to digital data and exposes a photosensitive material by recording light that has been modulated in accordance with the image data, thereby printing an image (a latent image) on photographic printing paper. Image data that has been obtained by a digital camera or mobile telephone equipped with a camera also is printed on photographic printing paper by a digital photo printer.
The state of image data handled by a digital photo printer is not necessarily uniform. For example, images are obtained by shooting pictures under various photographic light sources such-as daylight, a fluorescent lamp or a tungsten lamp, etc. Accordingly, in a case where a print is created from image data, a tint that is based upon the photographic light source may be reflected in the print if the image is printed without applying image processing.
A white balance correction (gray balance correction) is available as correction processing for obtaining an image print that is unaffected by the photographic light source.
The white balance correction is processing that controls the color balance of an image represented by image data to thereby correct the image data in such a manner that the image of a subject will be expressed by the appropriate color [e.g., in such a manner that the image of a white-colored subject will be expressed by the color white and the image of a skin-toned subject (the face area of a human being) by the color of skin]. The white balance correction generally is performed when the picture is taken. At such time the color temperature that conforms to the picture-taking conditions (or the type of light source used) is set in the digital camera. The white balance correction that conforms to the set color temperature or type of light source is carried out and the image data that has undergone the white balance correction is stored on a memory card or the like.
In a case where the white balance of an image represented by digital image data is corrected not at the time of photography but subsequent thereto, it is necessary that the color temperature that prevailed when the image represented by the digital image data was captured be decided (estimated) based upon information obtained from the digital image data.
The specification of Japanese Patent Application Laid-Open No. 2003-209856 teaches the utilization of a blackbody locus (skin-tone—blackbody locus and gray—blackbody locus) on a chromaticity diagram to decide (estimate) the color temperature of a light source. The R and B components of RGB values of an image obtained by a digital camera are multiplied by prescribed coefficients α1, α2 and the values obtained are converted to chromaticity values r, b, respectively. Pixels in the vicinity of the skin-tone—blackbody locus represented on the chromaticity diagram are detected as skin-tone candidate pixels, and pixels in the vicinity of the gray—blackbody locus represented on the chromaticity diagram are detected as gray candidate pixels. The prescribed coefficients α1, α2 are optimized in such a manner that the number of skin-tone candidate pixels in the vicinity of the skin-tone —black locus and the number of gray-candidate pixels in the vicinity of the gray—blackbody locus will be maximized or in such a manner that the difference between average color temperature of a group of skin-tone candidate pixels and average color temperature of a group of gray pixels will be minimized. The color temperature of the light source is decided (estimated) using the color temperature of skin-tone pixels detected based upon the skin-tone—blackbody locus and the color temperature of gray pixels detected based upon the gray—blackbody locus.
Thus, in the specification set forth above, if the values obtained by multiplying the R and B components of RGB values of an image obtained by a digital camera by the prescribed coefficients α1, α2 and converting the products to the chromaticity values r, b are indicative of pixels in the vicinity of the skin-tone —blackbody locus represented on the chromaticity diagram, then these pixels are adopted as skin-tone pixels; if the chromaticity values obtained are indicative of pixels in the vicinity of the gray—blackbody locus, then these pixels are adopted as gray pixels. Often, however, an image prior to application of the white balance correction will not be in color balance. Consequently, there is a limitation upon the detection of skin-tone pixels and gray pixels using only color information as set forth in the above-cited specification. For example, it is conceivable that even if an image does not contain a skin-tone pixel and a gray pixel but does contain a pair of colors (e.g., pink and violet) in a relative color relationship with the skin-tone color and gray, then the pixels of these colors will be detected erroneously as skin-tone and gray pixels. As a result, the color temperature of the light source obtained in accordance with the skin-tone —blackbody locus and gray—blackbody locus may not be the appropriate light-source color temperature and there is the danger that the white balance correction will fail.